package server.exclusionstrategy;

import server.GameServer;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

/**
 * This class is used to exclude specific classes that cannot be modified
 * that would be serialized.
 */
public class LobbyExclusionStrategy implements ExclusionStrategy {

	@Override
	public boolean shouldSkipField(FieldAttributes f) {
		// Don't serialize the "gameModel" field in class GameServer
		return (f.getDeclaringClass() == GameServer.class && f.getName().equals("gameModel") ||
				f.getDeclaringClass() == GameServer.class && f.getName().equals("admin"));
	}

	@Override
	public boolean shouldSkipClass(Class<?> arg) {
		return false;
	}

}
